import { Mycloud } from '../../public';

Page({
  data: {

    // 转盘
    turntable: {
      url: 'https://img.alicdn.com/imgextra/i3/4161056916/O1CN01R385SC20xZorgqGJQ_!!4161056916.png',
      width: 577,
      height: 577,
    },

    // 按钮
    turntableBtn: {
      url: 'https://img.alicdn.com/imgextra/i4/4161056916/O1CN01qCUtVZ20xZoipZz8m_!!4161056916.png',
      width: 198,
      height: 410,
      left: 191,
      top: 0
    },

    // 奖品信息

    // 自动计算度数公式******
    // 测试******
    // 自动获取图片尺寸*******

    prizeSite: [
      {
        angle: 30,
        prize: '60优惠券'
      },
      {
        angle: 88,
        prize: '明星同款'
      },
      {
        angle: 147,
        prize: '20优惠券蓝'
      },
      {
        angle: 204,
        prize: '20优惠券黄'
      },
      {
        angle: 268,
        prize: '谢谢惠顾'
      },
      {
        angle: 324,
        prize: '20优惠券黄2'
      }
    ],

    prizeIndex: null, // 奖品下标
    lotteryCount: 5, // 抽奖次数
  },
  // 转盘滚动
  onStart() {

    let i=Math.ceil(Math.random()*5);
    console.log(i)
    // Mycloud('mt_test', { min: 0, max: 4 }, 'randomNumber').then(res => {
    //   console.log(res);
      this.setData({ prizeIndex: 0, lotteryCount: this.data.lotteryCount - 1 });
    // })
  },
  onFinish(prizeInfo) {
    console.log(prizeInfo);
    my.alert({ content: JSON.stringify(prizeInfo) })
    this.setData({ prizeIndex: null })
  },
  onLoad() { },
});

